home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Views / Includes / USynchScroller.h < prev    next >
Encoding:
Text File  |  1996-04-03  |  4.8 KB  |  141 lines  |  [TEXT/MPS ]

  1. // USynchScroller.h
  2. // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. #ifndef __USYNCHSCROLLER__
  5. #define __USYNCHSCROLLER__
  6.  
  7. // MacApp
  8.  
  9. #ifndef __UGEOMETRY__
  10. #include "UGeometry.h"
  11. #endif
  12.  
  13. #ifndef __USCROLLER__
  14. #include "UScroller.h"
  15. #endif
  16.  
  17.  
  18. //----------------------------------------------------------------------------------------
  19. // Forward and external class declarations. 
  20. //----------------------------------------------------------------------------------------
  21.  
  22. class TSecondaryScroller;
  23. class TList;
  24.  
  25.  
  26. //----------------------------------------------------------------------------------------
  27. // Constants
  28. //----------------------------------------------------------------------------------------
  29.  
  30. const short kVDependent = 1;                    // Dependent scroller is dependent on
  31.                                                 // vertical translation 
  32.  
  33. const short kNotVDependent = 0;                    // Dependent scroller is NOT dependent on
  34.                                                 // vertical translation 
  35.  
  36. const short kHDependent = 1;                    // Dependent scroller is dependent on
  37.                                                 // horizontal translation 
  38.  
  39. const short kNotHDependent = 0;                    // Dependent scroller is NOT dependent on
  40.                                                 // horizontal translation 
  41.  
  42. //----------------------------------------------------------------------------------------
  43. // TPrimaryScroller: A TPrimaryScroller has a list of secondary scrollers (if non-NULL):
  44. // When it scrolls it makes the scrollers on the list scroll too in the very same
  45. // ScrollRect toolbox call if possible. If some of the secondary scrollers can't be
  46. // scrolled in the same ScrollRect call because they only scroll in one direction then
  47. // they will be scrolled separately as necessary. 
  48. //----------------------------------------------------------------------------------------
  49.  
  50. class TPrimaryScroller : public TScroller
  51. {
  52.     MA_DECLARE_CLASS;
  53.     
  54. public:
  55.     TList* fSecondaryScrollers;                    // The list of secondary scrollers, if any
  56.  
  57.     TPrimaryScroller();
  58.         // Constructor
  59.         
  60.     void IPrimaryScroller(TView* itsSuperView,
  61.                                   const VPoint& itsLocation,
  62.                                   const VPoint& itsSize,
  63.                                   SizeDeterminer itsHSizeDet,
  64.                                   SizeDeterminer itsVSizeDet,
  65.                                   const VPoint& itsMax,
  66.                                   Boolean wantHorzSBar,
  67.                                   Boolean wantVertSBar);
  68.         // Initialization method for TPrimaryScroller.
  69.  
  70.     virtual ~TPrimaryScroller();
  71.         // Frees its list 
  72.  
  73.     virtual void AddSecondaryScroller(TSecondaryScroller* itsSecondaryScroller,
  74.                                              VCoordinate itsHDependency,
  75.                                              VCoordinate itsVDependency);
  76.         // Become associated with the secondary scroller(s). The V and H dependencies
  77.         // could someday be scale factors but for now are kVDependent and kHDependent for
  78.         // now. 
  79.  
  80.     virtual void RemoveSecondaryScroller(TSecondaryScroller* itsSecondaryScroller);
  81.         // Remove the secondary scroller. 
  82.  
  83.     virtual void DoScroll(const VPoint& delta, Boolean redraw);
  84.         // Assure that fTranslation is always updated in the secondary scrollers 
  85.  
  86.     virtual void ScrollDraw(const VPoint& delta, Boolean invalidate);
  87.         // Scroll the secondary scrollers as well (unless called via SetScrollLimits) 
  88.  
  89. };
  90.  
  91.  
  92. //----------------------------------------------------------------------------------------
  93. // TSecondaryScroller: A TSecondaryScroller is controlled by a TPrimaryScroller (see
  94. // above). When it is told to scroll, it delegates the job to the TPrimaryScroller.
  95. // Constraints (none are checked by this unit at this time): 1. It and its subview must
  96. // have the same length in the desired synch-scroll directions. 2. Commands for dragging
  97. // within it must have it as their fScroller. 3. No scroll bars! 
  98. //----------------------------------------------------------------------------------------
  99.  
  100. class TSecondaryScroller : public TScroller
  101. {
  102.     MA_DECLARE_CLASS;
  103.     
  104. public:
  105.     TPrimaryScroller* fPrimaryScroller;            // the primary scroller 
  106.  
  107.     CPoint fDeltaFactor;                            // kVDependent and kHDependent (or not) 
  108.  
  109.     TSecondaryScroller();
  110.         // Constructor
  111.         
  112.     void ISecondaryScroller(TView* itsSuperView,
  113.                                   const VPoint& itsLocation,
  114.                                   const VPoint& itsSize,
  115.                                   SizeDeterminer itsHSizeDet,
  116.                                   SizeDeterminer itsVSizeDet,
  117.                                   const VPoint& itsMax,
  118.                                   Boolean wantHorzSBar,
  119.                                   Boolean wantVertSBar);
  120.         // Initialization method for TSecondaryScroller.
  121.  
  122.     virtual ~TSecondaryScroller();
  123.  
  124.     virtual void DoScroll(const VPoint& delta, Boolean redraw);
  125.         // Polarize and delegate scroll attempts to the primary scroller (unless called
  126.         // via SetScrollLimits) 
  127.  
  128. };
  129.  
  130.  
  131. //----------------------------------------------------------------------------------------
  132. // Global function declarations
  133. //----------------------------------------------------------------------------------------
  134.  
  135. extern void InitUSynchScroller();
  136.  
  137.  
  138. #endif
  139.  
  140.  
  141.